public without sharing class SalesAreaBudgetExecSheetHandler{

    public static void updateOwner(List<SalesAreaBudgetExecSheet__c> list_new){
    
        Set<String>acc = new Set<String>();
        for(SalesAreaBudgetExecSheet__c sa: list_new){
        
          if(sa.RegionCoding__c != null)acc.add(sa.RegionCoding__c);
        }
        //查询用户
       Map<String,Id> RegionCodeMap = new Map<String,Id>();
       for(User a : [select Id,AreaCode__c from User where isActive = true and AreaCode__c in: acc]){
           RegionCodeMap.put(a.AreaCode__c,a.Id);
       }
        
       for(SalesAreaBudgetExecSheet__c sa: list_new){
            if(RegionCodeMap.containsKey(sa.RegionCoding__c)){
                sa.OwnerId = RegionCodeMap.get(sa.RegionCoding__c);
            }
        }
    }
}